extension_icon_dict = {
    'bat': 'fa fa-terminal',
}

extension_icon_default = 'fa fa-info-circle'

extension_data = [
    ('image', 'fa fa-picture-o', set(['ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2',
     'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'webp', 'avif', 'svg', ])),

    ('code', 'fa fa-file-code-o', set(['passwd', 'ftpquota', 'sql', 'js', 'json', 'sh', 'config',
     'twig', 'tpl', 'md', 'gitignore', 'c', 'cpp', 'cs', 'py', 'rs', 'map', 'lock', 'dtd', ])),

    ('text', 'fa fa-file-text-o',
     set(['txt', 'ini', 'conf', 'log', 'htaccess'])),

    ('css', 'fa fa-css3', set(['css', 'less', 'sass', 'scss'])),

    ('archive', 'fa fa-file-archive-o',
     set(['bz2', 'zip', 'rar', 'gz', 'tar', '7z', 'xz', ])),

    ('code-php', 'fa fa-code',
     set(['php', 'php4', 'php5', 'phps', 'phtml', ])),

    ('html', 'fa fa-html5', set(['htm', 'html', 'shtml', 'xhtml', ])),

    ('xml', 'fa fa-file-excel-o', set(['xml', 'xsl', ])),

    ('audio', 'fa fa-music', set(['wav', 'mp3', 'mp2', 'm4a',
     'aac', 'ogg', 'oga', 'wma', 'mka', 'flac', 'ac3', 'tds', ])),

    ('playlist', 'fa fa-headphones',
     set(['m3u', 'm3u8', 'pls', 'cue', 'xspf', ])),

    ('video', 'fa fa-file-video-o', set(['avi', 'mpg', 'mpeg', 'mp4', 'm4v',
     'flv', 'f4v', 'ogm', 'ogv', 'mov', 'mkv', '3gp', 'asf', 'wmv', ])),

    ('mail', 'fa fa-envelope-o', set(['eml', 'msg', ])),

    ('excel', 'fa fa-file-excel-o', set(['xml', 'xsl', 'xslx', ])),

    ('cvs', 'fa fa-file-text-o', set(['cvs', ])),

    ('backup', 'fa fa-clipboard', set(['bak', 'swp', ])),

    ('doc', 'fa fa-file-word-o', set(['doc', 'docx', 'odt', ])),

    ('ppt', 'fa fa-file-powerpoint-o', set(['ppt', 'pptx', ])),

    ('font', 'fa fa-font',
     set(['ttf', 'ttc', 'otf', 'woff', 'woff2', 'eot', 'fon', ])),

    ('pdf', 'fa fa-file-pdf-o', set(['pdf', ])),

    ('image', 'fa fa-file-image-o', set(['psd', 'ai', 'eps', 'fla', 'swf', ])),

    ('exe', 'fa fa-file-o', set(['exe', 'msi', ])),

    ('terminal', 'fa fa-terminal', set(['bat', 'sh', ])),
]


def extension_to_icon(ext):
    for _ in extension_data:
        if ext in _[-1]:
            return _[1]
    return 'fa fa-info-circle'
